var http=require("http");
var data = [];
var server=http.createServer(function(req,res){
	console.log(req.url);
	var str=req.url.split("?");
	var url = str[0];
	if(url.startsWith("/do")){
	str = str[1];
	var arr = str.split("&");
	var one = {};
	console.log(arr);
	arr.forEach(function(o){
		var s = o.split("=");
		one[s[0]]=s[1];
	});
	data.push(one);
	console.log(data);
	
	res.setHeader("Content-Type","text/html");
	var str = "<table>";
	data.forEach(function(o){
		str += "<tr>";
		Object.keys(o).forEach(function(m){
			str+="<td>" + o[m] + "</td>";
		});
		str +="</tr>";
	});
	str+="</table>";
	res.end(str);
	}else
	{
		res.setHeader("Content-Type","text/html");
		console.log("Other url");
	}
	res.end("<h1>hello world</h1>");
});
server.listen(3000);


